package com.ywk.effective.enumdesign;

public enum WeekEnum {
    Monday(), Tuesday(), Sunday(PayEnum.Weekend);

    final PayEnum pay;

    WeekEnum() {
        this(PayEnum.WeekDay);
    }

    WeekEnum(PayEnum payEnum) {
        this.pay = payEnum;
    }

    public int pay() {
        return pay.pay();
    }

    public enum PayEnum {
        WeekDay() {
            @Override
            public int overtimePay() {
                return 0;
            }
        }, Weekend() {
            @Override
            public int overtimePay() {
                return 1;
            }
        };

        public abstract int overtimePay();

        public int pay() {
            return 1 + overtimePay();
        }
    }

    public static void main(String[] args) {
        System.out.println(WeekEnum.Monday.pay());
        System.out.println(WeekEnum.Sunday.pay());

    }
}
